/**手机号校验*/
export const phoneFun = (params) => {
  const phoneRule =
    /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/
  const regex = new RegExp(phoneRule)
  return regex.test(params)
}

/***身份证校验*/
export const cardIdFun = (params) => {
  const cardIdRule =
    /(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)|(^\d{6}(18|19|20)\d{2}(0[1-9]|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/
  const regex = new RegExp(cardIdRule)
  return regex.test(params)
}

/***包含大写校验*/
export const hasUpperCaseFun = (params) => {
  const cardIdRule = /^.*(?=.*[A-Z]).*$/
  const regex = new RegExp(cardIdRule)
  return regex.test(params)
}

/***包含小写校验*/
export const hasLowerCaseFun = (params) => {
  const cardIdRule = /^.*(?=.*[a-z]).*$/
  const regex = new RegExp(cardIdRule)
  return regex.test(params)
}

/***包含数字校验*/
export const hasCharacterFun = (params) => {
  const cardIdRule = /^.*(?=.*[!@#$%^&*? ]).*$/
  const regex = new RegExp(cardIdRule)
  return regex.test(params)
}

/***包含数字校验*/
export const hasNumerFun = (params) => {
  const cardIdRule = /^.*(?=.*\d).*$/
  const regex = new RegExp(cardIdRule)
  return regex.test(params)
}

/***英文校验*/
export const checkEN = (params) => {
  const rules = /^[A-Za-z]+$/
  const regex = new RegExp(rules)
  return regex.test(params)
}

/***英文、空格*/
export const checkAlphaOrSpace = (params) => {
  const rules = /^[A-Za-z ]+$/
  const regex = new RegExp(rules)
  return regex.test(params)
}

/***英文、空格或数字*/
export const checkAlphaNumericOrSpace = (params) => {
  const rules = /^[A-Za-z0-9 ]+$/
  const regex = new RegExp(rules)
  return regex.test(params)
}

/***Email 邮箱*/
export const checkEmail = (params) => {
  const rules = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
  const regex = new RegExp(rules)
  return regex.test(params)
}
